"""
 -*- coding: utf-8-*-
 @File: record_log.py
 @Author: chen
 @time: 2023/09/15/ 20:55
"""
import datetime
import logging
import os

# picture_path = os.path.join(cur_path, f"../screenshot/screenshot_{timestamp}.PNG")
# picture_path = os.path.basename(picture_path)
now = datetime.datetime.now()
date_time = now.strftime("%Y-%m-%d")
logger = logging.getLogger(os.path.basename(__file__))
logger.setLevel(logging.DEBUG)
console_handler = logging.StreamHandler()
file_handler = logging.FileHandler(filename=f"../logs/{date_time}.log", encoding="utf-8")
console_handler.setLevel(logging.DEBUG)
file_handler.setLevel(logging.DEBUG)
formatter = logging.Formatter("%(asctime)s|%(filename)s:%(lineno)s|%(levelname)s|msg：%(msg)s")
console_handler.setFormatter(formatter)
file_handler.setFormatter(formatter)
logger.addHandler(console_handler)
logger.addHandler(file_handler)
logger.info("*"*69)

# def logger():
#     logger_obj = logging.getLogger(os.path.basename(__file__))
#     logger_obj.setLevel(logging.DEBUG)
#     console_handler = logging.StreamHandler()
#     file_handler = logging.FileHandler(filename="../logs/mylog.log", encoding="utf-8")
#     console_handler.setLevel(logging.DEBUG)
#     file_handler.setLevel(logging.DEBUG)
#     formatter = logging.Formatter("%(asctime)s|%(name)s:%(lineno)s|%(levelname)s|msg：%(msg)s")
#     console_handler.setFormatter(formatter)
#     file_handler.setFormatter(formatter)
#     logger_obj.addHandler(console_handler)
#     logger_obj.addHandler(file_handler)
#     return logger_obj


# if __name__ == '__main__':
#     logger().info("hello")
